;var PRO=PRO||{};
PRO.customerImportList=(function(){
	//动态绑定事件
	function bindEvents(){
		//导出数据
		$("#btnExport").click(function(){
			var html="";
			html+="<div style='padding: 10px;' id='sc_wrap'>";
			html+="<div style='padding-bottom: 10px'></div>";
			html+="<div><span style='color: red'>(*注：将会按您所设置的每个文件的记录数进行分组，例如5000条，则按每个文件5000条记录生成所有文件)</span></div>";
			html+="每个excel记录条数：<select style='width: 150px;' id='select_num'>	<option value='1000'>1000条</option><option value='5000' selected='selected'>5000条</option> <option value='10000'>10000条</option> </select>";
			html+=	'<div class="row" style="display: block;margin: 0 auto;width: 200px;margin-top: 30px;">';
			html+=		'<input id="btn_do_export"  class="btn btn-primary" type="submit" value="确认导出"/>&nbsp;&nbsp;&nbsp;';
			html+=		'<input id="btn_cancel_sc" class="btn" type="button" value="取消" />';
			html+='</div>';
			html+="</div>"
			//页面层
			layer.open({
				type: 1,
				title:"客户导出",
				skin: 'layui-layer-rim', //加上边框
				area: ['350px', '250px'], //宽高
				content: html
			});
		});
		$("body").on("click","#btn_cancel_sc",function () {
			layer.closeAll();
		});
		$("body").on("click","#btn_do_export",function () {
			var select_num=$("#select_num").val()||5000;
			$("#searchForm").attr("action", ctx + "/sys/customer/impt/customerImport/export?num="+select_num);
			$("#searchForm").submit();
			$("#searchForm").attr("action", ctx + "/sys/customer/impt/customerImport/");
			loading("正在导出！")
			setTimeout(function () {
				layer.closeAll();
				closeLoading();
			},1000)

		});
		//导入数据
		$("#btnImport1").click(function(){
			<!-- 导入弹窗begin -->
			//页面层
			layer.open({
				type: 2,
				offset: ['300px', '500px'],
				title:"客户导入",
				skin: 'layui-layer-rim', //加上边框
				area: ['350px', '200px'], //宽高
				content: ctx+"/sys/customer/impt/customerImport/importBox"
			});
		});

		//打印数据
		$("body").on("click","#btnPrint",function(){
			//$("div#myPrintArea").jqprint();  
			$("#searchForm").attr("action",ctx+"/sys/customer/impt/customerImport/printPage");
			$("#searchForm").submit();
		});


	}

	function initDom(){
		  $("select").select2();
	}
	return {
		//页面初始化
		init:function(){
			initDom();
			bindEvents();
		}
	}
})();
$(function(){
	PRO.customerImportList.init();
})